﻿//----------------------------------------------------------------
// Desc: 对象管理器
// Edit: ShowLong, http://blog.csdn.net/showlong
//
// Date Created: 2012-04-04
//
// Update Date : 
//
// Copyright (c) Fuel4D (http://www.fuel4d.com), All rights reserved.
//
//----------------------------------------------------------------
#pragma once


FINLINE IFSpriteObject* IFObjMgr::NewSprite(FIDSPRITE id, const WCHAR* spr_name)
{
    return NewSprite(id, FGetHashW(spr_name));
}

FINLINE IFSpriteObject* IFObjMgr::NewSprite(FIDSPRITE id, const ACHAR* spr_name)
{
    return NewSprite(id, FGetHashA(spr_name));
}

FINLINE void IFObjMgr::DelSpriteEx(IFSpriteObject*& spr)
{
    if (!spr)
        return;
    DelSprite(spr);
    spr = 0;
}

FINLINE void IFObjMgr::DelSpriteGroupEx(IFSpriteGroup*& gp)
{
    if (!gp)
        return;
    DelSpriteGroup(gp);
    gp = 0;
}

FINLINE IFSpriteCooling* IFObjMgr::NewCooling(FIDSPRITE id, const WCHAR* spr_name)
{
    return NewCooling(id, FGetHashW(spr_name));
}

FINLINE IFSpriteCooling* IFObjMgr::NewCooling(FIDSPRITE id, const ACHAR* spr_name)
{
    return NewCooling(id, FGetHashA(spr_name));
}

FINLINE void IFObjMgr::DelCoolingEx(IFSpriteCooling*& cd)
{
    if (!cd)
        return;
    DelCooling(cd);
    cd = 0;
}

FINLINE IFSpriteDistortion* IFObjMgr::NewDistortion(FIDSPRITE id, const WCHAR* spr_name, int cols, int rows)
{
    return NewDistortion(id, FGetHashW(spr_name), cols, rows);
}

FINLINE IFSpriteDistortion* IFObjMgr::NewDistortion(FIDSPRITE id, const ACHAR* spr_name, int cols, int rows)
{
    return NewDistortion(id, FGetHashA(spr_name), cols, rows);
}

FINLINE void IFObjMgr::DelDistortionEx(IFSpriteDistortion*& dis)
{
    if (!dis)
        return;
    DelDistortion(dis);
    dis = 0;
}

FINLINE IFSpriteParticle* IFObjMgr::NewParticle(FIDSPRITE id, const WCHAR* part_name)
{
    return NewParticle(id, FGetHashW(part_name));
}

FINLINE IFSpriteParticle* IFObjMgr::NewParticle(FIDSPRITE id, const ACHAR* part_name)
{
    return NewParticle(id, FGetHashA(part_name));
}

FINLINE void IFObjMgr::DelPartilceEx(IFSpriteParticle*& part)
{
    if (!part)
        return;
    DelPartilce(part);
    part = 0;
}

FINLINE IFSpriteTrack* IFObjMgr::NewTrack(FIDSPRITE id, const WCHAR* part_name)
{
    return NewTrack(id, FGetHashW(part_name));
}

FINLINE IFSpriteTrack* IFObjMgr::NewTrack(FIDSPRITE id, const ACHAR* part_name)
{
    return NewTrack(id, FGetHashA(part_name));
}

FINLINE void IFObjMgr::DelTrackEx(IFSpriteTrack*& track)
{
    if (!track)
        return;
    DelTrack(track);
    track = 0;
}